import {
    formInput
} from '@/css/DialogsCss.module.scss';
export default {
    title:'新增编辑',
    dialog:{
        width: 600,
        type:'dialog',
    },
    onMounted: [{
        action:'print',
        value:'$params'
    },{
        action:'set',
        target: '$view',
        field:'title',
        value:'$params.title'
    },{
        action: 'set',
        target: '$widgets.form',
        field: 'value',
        value: '$params.form'
    }],
    items: [{
        region: 'center',
        layout: 'vertical',
        items: [{
            layout: 'vertical',
            items: [{
                id: 'form',
                widget: 'form',
                fields:[{
                    class: formInput,
                    itemId: 'account',
                    placeholder: '请输入登陆账户',
                    widget: 'text',
                    label: '登陆账户',
                }, {
                    class: formInput,
                    itemId: 'real_name',
                    placeholder: '请输入真实姓名',
                    widget: 'text',
                    label: '真实姓名',
                }, {
                    itemId: 'state',
                    widget: 'form-radio',
                    value: 1,
                    options: [{
                        value: 1,
                        text: '启用'
                    }, {
                        value: 0,
                        text: '禁用'
                    }],
                    label: '用户状态',
                }],
                buttons: [{
                    value: '保存',
                    type: 'primary',
                    onClick: [{
                        action: 'confirm',
                        title: '表单保存',
                        message: '是否保存表单?',
                        confirm: [{
                            var:'value',
                            target:'$widget',
                            action:'call',
                            method:'getValue'
                        },{
                            action: 'service',
                            path: 'system/usergroup/user/save',
                            params:{
                                // role_id:'$params.role_id',
                                '...':['$vars.value']
                            }
                        },{
                            action:'dialog-hide',
                            mode:'apply'
                        }]
                    }]
                }],
                flex: true
            }]
        }]
    }]
};
